package com.artPreter.controller;



import com.artPreter.pojo.EventExhibitionBanner;
import com.artPreter.pojo.Result;
import com.artPreter.service.IBannerService;
import com.artPreter.service.IEventExhibitionBannerService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 活动展览轮播图片表 前端控制器
 * </p>
 *
 * @author jarvis
 * @since 2025-01-09
 */
@RestController
@RequestMapping("/eventExhibitionBanner")
public class EventExhibitionBannerController {


    @Autowired
    private IEventExhibitionBannerService eventExhibitionBannerService;

    /**
     * 板块分类分页
     * @param currentPage
     * @param size
     * @param
     * @return
     */
    @PostMapping("/getPage")
    public Result getPage(@RequestParam(value = "currentPage",defaultValue = "1") Integer currentPage, @RequestParam(value = "size",defaultValue = "10") Integer size, @RequestBody EventExhibitionBanner eventExhibitionBanner) {
        IPage<EventExhibitionBanner> bannerIPage = eventExhibitionBannerService.getPage(currentPage, size, eventExhibitionBanner);
        return Result.success(bannerIPage);
    }

    /**
     *  添加板块分类
     * @param eventExhibitionBanner
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody EventExhibitionBanner eventExhibitionBanner) {
        eventExhibitionBannerService.add(eventExhibitionBanner);
        return Result.success();
    }

    /**
     *  修改板块分类
     * @param
     * @return
     */
    @PostMapping("/edit")
    public Result edit(@RequestBody EventExhibitionBanner eventExhibitionBanner) {
        eventExhibitionBannerService.edit(eventExhibitionBanner);
        return Result.success();
    }

    /**
     * 删除板块分类
     * @param
     * @return
     */
    @PostMapping("/delete")
    public Result delete(@RequestBody EventExhibitionBanner eventExhibitionBanner){
        eventExhibitionBannerService.delete(eventExhibitionBanner);
        return Result.success();
    }

    /**
     * 获取板块分类列表
     * @param
     * @return
     */
    @PostMapping("/getList")
    public Result getList(@RequestBody EventExhibitionBanner eventExhibitionBanner){
        List<EventExhibitionBanner> result = eventExhibitionBannerService.getList(eventExhibitionBanner);
        return Result.success(result);
    }

}
